import 'package:flutter/material.dart';
import 'page1.dart';
import 'page2.dart';

void main() => runApp(A());

class A extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
        return MaterialApp(
            title: '任务标题',
            routes: {
                "page1": (context) => Page1(),
                "page2": (context) => Page2()
            },
            home: B()
        );
    }
}

class B extends StatefulWidget {
    @override
    C createState() => C();
}

class C extends State<B> {
    @override
    Widget build(BuildContext context) {
        var button1 = RaisedButton(
            child: Text("page1"),
            onPressed: () {
                Navigator.pushNamed(context, "page1");
            }
        );
        var button2 = RaisedButton(
            child: Text("page2"),
            onPressed: () {
                Navigator.pushNamed(context, "page2");
            }
        );
        var column = Column(children: <Widget>[button1, button2]);
        return Scaffold(
            appBar: AppBar(title: Text("我是Title")),
            body: Center(child: column)
        );
    }
}